﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Blizzard.Contracts;
using Blizzard.Interceptors;

namespace Blizzard.Test.DataObjects
{
    [Mapper(Table = "a")]
    public class A : IDataObject
    {
        private Interceptor _interceptor;
        private string _name;

 
        [Mapper(Field = "ID", IsIdentityColumn = true)]
        public int Id { get; set; }

        
        [Mapper(Field = "Name")]
        public string Name 
        {
            get
            {
                _interceptor.Intercept(this, "Name", false);
                return _name;
            }
            set
            {
                _interceptor.Intercept(this, "Name", true, _name, value);
                _name = value;
            }
        }

        private BList<B> _bees;

        public BList<B> Bees
        {
            get 
            {
                _interceptor.Intercept(this, "Bees", false);
                return _bees; 
            }
            set 
            {
                _interceptor.Intercept(this, "Bees", true, _bees, value);
                _bees = value; 
            }
        }
        //public virtual BList<B> bees { get; set; }


        Container.BlizzardManager _manager;
        public Container.BlizzardManager Manager
        {
            set
            {
                _manager = value;
                _interceptor = new Interceptor(_manager);
            }
        }
    }
}
